package com.tanran.es.respository;

import com.tanran.es.model.MysqlBlog;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by Enzo Cotter on 2019/12/26.
 */
public interface MysqlBlogRespository extends JpaRepository<MysqlBlog,Long> {
    @Query("select e from MysqlBlog e where (e.title like " +
            "concat('%',:keyword,'%') or e.content like concat('%',:keyword,'%s'))" +
            "order by e.createTime desc ")
     List<MysqlBlog> queryBlog(String keyword,Pageable pageable);
    @Query("select e from MysqlBlog e  order by e.createTime desc ")
     List<MysqlBlog> queryAll(Pageable pageable);
}
